#include "Face.h"
#include "Util.h"
#include <stdio.h>

Face::Face()
{
}

Face::Face
(Vertex3D *v1, 
 Vertex3D *v2, 
 Vertex3D *v3): 
  _v1(v1), _v2(v2), _v3(v3)
{ 
  GLdouble vecBA[3];
  vecBA[0] = v1->x()-v2->x();
  vecBA[1] = v1->y()-v2->y();
  vecBA[2] = v1->z()-v2->z();
  Vertex3D *BA = new Vertex3D(vecBA);
  GLdouble vecCA[3];
  vecCA[0] = v1->x()-v3->x();
  vecCA[1] = v1->y()-v3->y();
  vecCA[2] = v1->z()-v3->z();
  Vertex3D *CA = new Vertex3D(vecCA);

  vec3_prod(*CA,*BA,_normal);
  normalize(_normal);
}

Face::~Face () {}

Vertex3D*
Face::v1() const {return _v1;}

Vertex3D*
Face::v2() const {return _v2;}

Vertex3D*
Face::v3() const {return _v3;}

GLdouble*
Face::normal() {return _normal;}
